package com.zy.cat.entity.jd;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zy.cat.common.utils.TJKUtils;
import com.zy.cat.entity.jd.JDGoods.CommentInfo;
import com.zy.cat.entity.jd.JDGoods.CommentList;
import com.zy.cat.entity.jd.JDGoods.UrlInfo;
import com.zy.cat.entity.jd.JDGoods.VideoInfo;
import com.zy.cat.entity.jd.JDGoods.CouponInfo.Coupon;
import com.zy.cat.entity.jd.JDGoods.VideoInfo.Video;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jd.union.open.goods.jingfen.query.response.CategoryInfo;
import jd.union.open.goods.jingfen.query.response.CommissionInfo;
import jd.union.open.goods.jingfen.query.response.CouponInfo;
import jd.union.open.goods.jingfen.query.response.ImageInfo;
import jd.union.open.goods.jingfen.query.response.PinGouInfo;
import jd.union.open.goods.jingfen.query.response.PriceInfo;
import jd.union.open.goods.jingfen.query.response.ResourceInfo;
import jd.union.open.goods.jingfen.query.response.ShopInfo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@Data
@RequiredArgsConstructor
@AllArgsConstructor
@ApiModel("京东类似商品实体类")
public class JDJFGoods implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1312121212332222L;

	
	@ApiModelProperty("资源信息")
	   private ResourceInfo resourceInfo;
	   
	   @ApiModelProperty("30天引单数量")
	   private Long inOrderCount30DaysSku;
	   
		@ApiModelProperty("预估佣金")
		private long fcode;

		@ApiModelProperty("商品落地页，用于高佣转链")
		private String materialUrl;

		@ApiModelProperty("商品名称")
		private String skuName;

		@JsonIgnore
		@ApiModelProperty("拼购信息")
		private PinGouInfo pinGouInfo;

		@ApiModelProperty("类目信息")
		private CategoryInfo categoryInfo;

		@ApiModelProperty("spuid，其值为同款商品的主skuid")
		private String spuid;

		@ApiModelProperty("是否爆款，1：是，0：否")
		private String isHot;

		@ApiModelProperty("品牌名称")
		private String brandName;

		@ApiModelProperty("图片信息")
		private ImageInfo imageInfo;

		@ApiModelProperty("品牌code")
		private String brandCode;

		@ApiModelProperty("价格信息")
		private PriceInfo priceInfo;

		@ApiModelProperty("店铺信息")
		private ShopInfo shopInfo;

		@ApiModelProperty("g=自营，p=pop")
		private String owner;

		@JsonIgnore
		@ApiModelProperty("佣金信息")
		private CommissionInfo commissionInfo;

		@ApiModelProperty("商品ID")
		private String skuId;

		@ApiModelProperty("商品好评率")
		private String goodCommentsShare;

		@ApiModelProperty("优惠券信息，返回内容为空说明该SKU无可用优惠券")
		private CouponInfo couponInfo;

		@ApiModelProperty("30天引单数量")
		private Long inOrderCount30Days;

		@ApiModelProperty("评论数")
		private String comments;
 

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品拼购信息实体类")
		public static class PinGouInfo {
			@ApiModelProperty("拼购成团所需人数")
			private String pingouTmCount;

			@ApiModelProperty("拼购落地页url")
			private String pingouUrl;

			@ApiModelProperty("拼购结束时间")
			private String pingouEndTime;

			@ApiModelProperty("拼购价格")
			private String pingouPrice;

			@ApiModelProperty("拼购开始时间")
			private String pingouStartTime;

			public void setPingouStartTime(String pingouStartTime) {
				if (StringUtils.isNumeric(pingouStartTime)) {
					this.pingouStartTime = TJKUtils.UnixToDateTime(null, Long.parseLong(pingouStartTime));
				} else {
					this.pingouStartTime = "";
				}
			}

			public void setPingouEndTime(String pingouEndTime) {
				if (StringUtils.isNumeric(pingouEndTime)) {
					this.pingouEndTime = TJKUtils.UnixToDateTime(null, Long.parseLong(pingouEndTime));
				} else {
					this.pingouEndTime = "";
				}
			}

		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品类目信息实体类")
		public static class CategoryInfo {
			@ApiModelProperty("三级类目id")
			private String cid3;

			@ApiModelProperty("二级类目名称")
			private String cid2Name;

			@ApiModelProperty("二级类目id")
			private String cid2;

			@ApiModelProperty("三级类目名称")
			private String cid3Name;

			@ApiModelProperty("一级类目名称")
			private String cid1Name;

			@ApiModelProperty("一级类目id")
			private String cid1;
		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("资源信息")
		public static class ResourceInfo {
				@ApiModelProperty("频道id")
				private String eliteId;
				
				@ApiModelProperty("频道名称")
				private String eliteName;
		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品AAA实体类")
		public static class UrlInfo {
			@ApiModelProperty("图片地址")
			private String url;
		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品图片信息实体类")
		public static class ImageInfo {
			@ApiModelProperty("图片列表")
			private List<UrlInfo> imageList;
		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品价格信息实体类")
		public static class PriceInfo {

			@ApiModelProperty("无线价格")
			private String price;

			@ApiModelProperty("最低价后的优惠券价最低价后的优惠券价(当商品无最优券时，不返回该字段)")
			private String lowestCouponPrice;

			@ApiModelProperty("最低价格类型，1：无线价格；2：拼购价格； 3：秒杀价格")
			private String lowestPriceType;

			@ApiModelProperty("最低价格")
			private String lowestPrice;

		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品店铺信息实体类")
		public static class ShopInfo {

			@ApiModelProperty("店铺ID")
			private String shopId;

			@ApiModelProperty("店铺名称")
			private String shopName;

			@ApiModelProperty("店铺等级")
			private String shopLevel;

		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品佣金信息实体类")
		public static class CommissionInfo {

			@ApiModelProperty("佣金比例")
			private Double commissionShare;

			@ApiModelProperty("券后佣金")
			private Double couponCommission;

			@ApiModelProperty("plus券后佣金比例")
			private Double plusCommissionShare;

			@ApiModelProperty("佣金")
			private Double commission;

		}

//		@Data
//		@RequiredArgsConstructor
//		@AllArgsConstructor
//		@ApiModel("优惠券集合实体类")
//		public static class CouponList {
//			@ApiModelProperty("优惠券集合")
//			private Coupon coupon;
//		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品优惠券信息实体类")
		public static class CouponInfo {
			@ApiModelProperty("优惠券集合")
			private List<Coupon> couponList;

			@Data
			@RequiredArgsConstructor
			@AllArgsConstructor
			@Builder
			@ApiModel("京东商品优惠券明细实体类")
			public static class Coupon {
				@ApiModelProperty("券领取结束时间")
				private String getEndTime;

				@ApiModelProperty("领取开始时间")
				private String getStartTime;

				@ApiModelProperty("券消费限额")
				private String quota;

				@ApiModelProperty("券使用平台 (平台类型：0 - 全平台券，1 - 限平台券)")
				private String platformType;

				@ApiModelProperty("券有效使用结束时间")
				private String useEndTime;

				@ApiModelProperty("券有效使用开始时间")
				private String useStartTime;

				@ApiModelProperty("券种类 (优惠券种类：0 - 全品类，1 - 限品类（自营商品），2 - 限店铺，3 - 店铺限商品券)")
				private String bindType;

				@ApiModelProperty("最优优惠券，1：是；0：否")
				private String isBest;

				@ApiModelProperty("券链接")
				private String link;

				@ApiModelProperty("券面额")
				private String discount;

				public void setGetEndTime(String getEndTime) {
					if (StringUtils.isNumeric(getEndTime)) {
						this.getEndTime = TJKUtils.UnixToDateTime(null, Long.parseLong(getEndTime));
					} else {
						this.getEndTime = "";
					}
				}

				public void setGetStartTime(String getStartTime) {
					if (StringUtils.isNumeric(getStartTime)) {
						this.getStartTime = TJKUtils.UnixToDateTime(null, Long.parseLong(getStartTime));
					} else {
						this.getStartTime = "";
					}
				}

				public void setUseEndTime(String useEndTime) {
					if (StringUtils.isNumeric(useEndTime)) {
						this.useEndTime = TJKUtils.UnixToDateTime(null, Long.parseLong(useEndTime));
					} else {
						this.useEndTime = "";
					}
				}

				public void setUseStartTime(String useStartTime) {
					if (StringUtils.isNumeric(useStartTime)) {
						this.useStartTime = TJKUtils.UnixToDateTime(null, Long.parseLong(useStartTime));
					} else {
						this.useStartTime = "";
					}
				}
			}
		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品评价详情实体类")
		public static class CommentList {
			@ApiModelProperty("评价内容")
			private String content;

			@ApiModelProperty("评价图片集合")
			private List<UrlInfo> imageList;
		}

		@Data
		@RequiredArgsConstructor
		@AllArgsConstructor
		@ApiModel("京东商品评价信息实体类")
		public static class CommentInfo {
			@ApiModelProperty("评价集合")
			private List<CommentList> commentList;

		}

}
